package com.bestcem.xm.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 角色状态 0: 活动的 1: 禁用的
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/16 14:42
 */
@Getter
@AllArgsConstructor
public enum RoleStatusEnum {

    ACTIVATED(0, "活动的"),
    INACTIVATED(1, "禁用的"),
    ;

    private final Integer type;

    private final String desc;

    /**
     * 通过type获取
     *
     * @param type
     * @return
     */
    public static RoleStatusEnum getByType(Integer type) {
        if (type != null) {
            for (RoleStatusEnum value : values()) {
                if (value.getType().equals(type)) {
                    return value;
                }
            }
        }
        return null;
    }

}
